package com.woniuxy.dao.impl;

import com.woniuxy.dao.RbacManagerDao;
import com.woniuxy.entity.RbacManager;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

/**
 * @Author: 马宇航
 * @Todo: 静态代理，通过我们手动去实现这个代理类！
 *         问题：1.写死不灵活
 *              2.只能代理一个接口
 *              3.代码量大
 * @DateTime: 22/08/22/0022 11:42
 * @Component: 成都蜗牛学苑
 **/
public class RbacManagerDaoImpl implements RbacManagerDao {
    private SqlSession sqlSession;

    public void setSqlSession(SqlSession sqlSession) {
        this.sqlSession = sqlSession;
    }

    @Override
    public RbacManager findOne(int id) {
        RbacManagerDao rbacManagerDao = sqlSession.getMapper(RbacManagerDao.class);
        return rbacManagerDao.findOne(id);
    }

    @Override
    public List<RbacManager> findAll() {
        RbacManagerDao rbacManagerDao = sqlSession.getMapper(RbacManagerDao.class);
        return rbacManagerDao.findAll();
    }

    @Override
    public int addOne(RbacManager rbacManager) {
        RbacManagerDao rbacManagerDao = sqlSession.getMapper(RbacManagerDao.class);
        return rbacManagerDao.addOne(rbacManager);
    }

    @Override
    public int updateOne(RbacManager rbacManager) {
        return 0;
    }

    @Override
    public int deleteOne(int id) {
        return 0;
    }

    @Override
    public List<RbacManager> findOneByLikeName(String name) {
        return null;
    }
}
